﻿package mortal.game.view.copy.guildCopy.renderer
{
    import Message.Public.*;
    import com.mui.controls.*;
    import flash.display.*;
    import flash.geom.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;

    public class GuildCopyRewardItemListCellRenderer extends GCellRenderer
    {
        private var _item:BaseItem;

        public function GuildCopyRewardItemListCellRenderer()
        {
            return;
        }// end function

        public function get itemBitmapData() : BitmapData
        {
            return this._item.bitmapdata;
        }// end function

        public function get pos() : Point
        {
            return this._item.localToGlobal(new Point(this._item.x, this._item.y));
        }// end function

        override public function get data() : Object
        {
            return super.data;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            if (param1 is ItemData)
            {
                this._item.itemData = param1 as ItemData;
            }
            else if (param1 is ItemInfo)
            {
                this._item.itemCode = param1.code;
            }
            else if (param1 is SPlayerItem)
            {
                this._item.itemData = new ItemData(param1);
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._item = UIFactory.getUICompoment(BaseItem, 2, 2, this);
            this._item.setItemStyle(ItemStyleConst.Small, ImagesConst.PackItemBg, 2, 2);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._item.itemData = null;
            this._item.dispose(param1);
            this._item = null;
            return;
        }// end function

    }
}
